from sqlalchemy import Column

from apps.db import BaseModel, String


class DiyaPerson(BaseModel):
    """抵押人信息"""
    __tablename__ = 'tb_diya_person_info'
    telphone = Column(String, comment='联系电话')
    name = Column(String, comment='抵押人名字')
    no = Column(String, comment='抵押人在3.0系统中的编号')
    address = Column(String, comment='联系地址')
    cust_id = Column(String)
    cert_type = Column(String)
    cert_no = Column(String, comment='证件号')
    extend_id = Column(String, comment='关联backSideExtendInfo')

    def __init__(self, *args, **kwargs):
        super(DiyaPerson, self).__init__()
        for attr, value in kwargs.items():
            if attr in self.__column_name_list__() and getattr(self, attr) is None:
                setattr(self, attr, value)
